/**Jakub Pilch
 * Informatyka IEiT
 * grupa 4, rok I.
 */
package calculate;

import javax.swing.*;
import java.awt.*;

/**Calculate zawiera cialo kalkulatora, buduje podzespoly
 * konstruowane z innych klas.
 * Uzyto prostych layoutow - BorderLayout + GridLayout, ktore
 * odpowiednio ulozone daly zadowalajace efekty.
 */
public class Calculate extends JFrame {
    
    static JTextField l1, l2;
    static char sig = '0';
    static char ssig = '0';
    static double nbr1 = 0;
    static double nbr2 = 0;
    static double snbr1 = 0;
    static double snbr2 = 0;
    static double result = 0;
    static double sresult = 0;

    public Calculate(){
        super ("Kalkulator - © Jakub Pilch.");
        setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);   //akcja przy zamknieciu
               
        setSize(500, 350);
        setLocation(50,50);
        setLayout(new BorderLayout());
        
        l1 = new JTextField();
        l1.setComponentOrientation(ComponentOrientation.RIGHT_TO_LEFT);
        l2 = new JTextField();
        l2.setComponentOrientation(ComponentOrientation.RIGHT_TO_LEFT);
        
                
        JTabbedPane zakladki = new JTabbedPane();       //prosta lub naukowa wersja. 
        
        JPanel simple = new JPanel();                   //wersja prosta.
        simple.setLayout(new BorderLayout());
        simple.add(BorderLayout.NORTH, l1);
        simple.add(new Numbers());
        simple.add(BorderLayout.EAST, new Executors());
        zakladki.addTab("Wersja prosta", simple);
        
        JPanel scientific = new JPanel();
        scientific.setLayout(new BorderLayout());
        scientific.add(BorderLayout.NORTH, l2);
        scientific.add(new SNumbers());
        scientific.add(BorderLayout.EAST, new SciExecutors());
        zakladki.addTab("Wersja naukowa", scientific);
        
        add(zakladki);
        setVisible(true);
    }

    
    public static void main(String[] args) {
        EventQueue.invokeLater(new Runnable(){
            public void run(){
               new Calculate();
            }
        });
    }
}
